Light sensors are now widely applied in electronic devices such as a mobile phone, a tablet computer and a laptop computer or the like. Generally, the top edge on the front side of the housing of an electronic device is provided with a small hole in which a light sensor is disposed. When ambient light produced by a light source passes through the small hole and reaches the light sensor, the electronic device may measure the brightness value of the ambient light by the light sensor.